{template 'common/header'}
<script>
    $(function(){
        $(".sign_up").on('click',function(){
            if(confirm("是否确定该件已经发货了？")){
                var url = "{php echo $this->createWebUrl('deliver',array('op' => 'sign_up'))}";
                var goods_id = $(this).attr("goods_id");
                var get_name = $("#get_name"+goods_id).val();
                $.ajax({
                    type : 'post',
                    url : url,
                    data : {'goods_id' : goods_id,'get_name' : get_name},
                    success : function(data){
                        if(data == 111){
                            location.reload();
                        }
                    }
                });
            }
        });
        $(".sign_all").on('click',function(){
            if(confirm("是否确定已经全部发货？")){
                $("#form").submit();
            }
        });
    });
</script>
<ul class="nav nav-tabs">
    <li {if $express_status == 0} class="active" {/if}><a href="{php echo $this->createWebUrl('deliver', array('op'=>'index'))}">未发货</a></li>
    <li {if $express_status == 1} class="active" {/if}><a href="{php echo $this->createWebUrl('seliver', array('op'=>'index','express_status' => 1))}">已发货</a></li>
</ul>
<div>
    <form action="" method="post" class="form-horizontal form" id="form" enctype="multipart/form-data">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <div class="panel-title">
                    <span>{$order['name']}</span>
                    <span>{$order['phone']}</span>
                    <span style="float: right">{$order['day']}</span>
                </div>
            </div>
            <div class="panel-body">
                <table class="table">
                    <tr>
                        <th>商品</th>
                        <th>数量</th>
                        <th>单价</th>
                        <th>运费</th>
                        <th>代付</th>
                        <th>已收运费</th>
                        <th>已收代付款</th>
                        <th>应收</th>
                        <th>到站点</th>
                        <!--<th>快递公司</th>-->
                        <!--<th>单号</th>-->
                        <!--<th>编号</th>-->
                        <th>备注</th>
                        <th>操作</th>
                    </tr>
                    {loop $order_goods $goods}
                    <tr>
                        <td>{$goods['name']}</td>
                        <td>{$goods['numbers']}{$goods['u_name']}</td>
                        <td>{$goods['freight']}</td>
                        <td>{$goods['total_freight']}</td>
                        <td>{$goods['gen_pay']}</td>
                        <td>{$goods['had_freight']}</td>
                        <td>{$goods['had_gen_pay']}</td>
                        <td>{$goods['total_need']}</td>
                        <td>{$goods['region_name']}</td>
                        <td>{$goods['remark']}</td>

                        <td>
                            {if $express_status == 0}
                            <button type="button" class="btn btn-primary sign_up" goods_id="{$goods['id']}">发货</button>
                            {/if}
                        </td>
                    </tr>
                    {/loop}
                    <tr>
                        <td>合计</td>
                        <td>{$all_numbers}</td>
                        <td></td>
                        <td>{$all_freight}</td>
                        <td>{$all_gen}</td>
                        <td>{$all_had_freight}</td>
                        <td>{$all_had_gen}</td>
                        <td>{$all_need}</td>
                        <td ></td>
                        <td>
                            {if $express_status == 0}
                            <input type='hidden' name='order_id' value="{$order['id']}" />
                            <input type="submit" name="submit" value="全部发货" class="btn btn-success" />
                            <input type="hidden" name="token" value="{$_W['token']}" />
                            {/if}
                            <a href="{php echo $this->createWebUrl('deliver')}">
                                <button type="button" class="btn btn-danger">返回</button>
                            </a>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</div>

{template 'common/footer'}